public class SumFac {
    public static int sunfac(int x){
        int sum = 0;
        for (int i=x;i>=1;i--){
            int ret = 1;
            for (int j=i;j>=2;j--){
                ret*= j;
            }
            sum+=ret;
        }
        return sum;
    }
    public static void main(String[] args) {
        int x= 4;
        int ret =sunfac(x);
        System.out.println(ret);
    }
}
